package com.example.demo.Controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: H_tao_X
 * Date: 2022-11-22
 * Time: 13:04
 */

@Controller
public class UserController2 {

    // 读取 yml 配置文件
    // 通过 @Value 读取
    @Value("${myyml.string}")
    private String myyml;

    @Value("${server.port}")
    private Integer port;

    @ResponseBody // 返回分静态页面
    @RequestMapping("sayhi2") // 一级路由
    public String sayHi() {

        System.out.println(myyml);
        System.out.println(port);
        return "string + myyml + port"  + " " + myyml + " " + port;

    }
}
